/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entityBean;

import entity.Teachers;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author ADMIN
 */
@Stateless
public class TeachersFacade extends AbstractFacade<Teachers> {

    @PersistenceContext(unitName = "Cms_Portal_Source-ejbPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public TeachersFacade() {
        super(Teachers.class);
    }

    public int update(String tname, String tpass, String tfullname, int tid) {
        return em.createQuery("UPDATE Teachers t SET t.tname = :tname,t.tpass = :tpass,t.tfullname = :tfullname WHERE t.tid =" + tid).
                setParameter("tname", tname).
                setParameter("tpass", tpass).
                setParameter("tfullname", tfullname).
                executeUpdate();
    }
}
